<template>
  <div class="idea">
    <van-nav-bar title="意见建议" left-text="返回" left-arrow @click-left="onClickLeft" fixed />
    <div class="content">
      <van-form @submit="onSubmit">
        <van-field v-model="title" name="用户名" label="标题" placeholder="请输入标题" />

        <van-field
          class="cdb"
          v-model="content"
          rows="2"
          autosize
          type="textarea"
          maxlength="300"
          placeholder="请在此处输入意见内容"
          show-word-limit
        />

        <div style="margin: 16px;">
          <van-button round block type="info" native-type="submit">提交</van-button>
        </div>
      </van-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      title: "",

      content: ""
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    onSubmit(values) {
      let paramForm = {
        title: this.title,
        content: this.content
      };
      this.$axios.post("prod-api/app/personal/advice", paramForm).then(res => {
        if (200 == res.data.code) {
          this.$router.go(-1);
          this.$toast.fail(res.data.msg);
        } else {
          this.$toast.fail(res.data.msg);
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.content {
  padding-top: 50px;
}
.van-nav-bar {
  background: url("../assets/bg2.png");
}

.cdb {
  height: 200px;
  font-size: 13px;
}
</style>